#ifndef _DOCUMENT_ACCESS_H_
#define _DOCUMENT_ACCESS_H_

#include "structures.h"

/*
 * Retrieves all the documents present in the system.
 */
t_documents * getDocuments(char * filter, int * amount);

/*
 * Retrieves the content for a certain document, or ""
 * if it doesn't exist.
 * Receives the title of the document.
 */
char * getDocument(char * title, char * sector, char * level);

/*
 * Creates a document, given its title, sector, level, content and the content size.
 * Returns 1 for OK, 0 for error.
 */
int createDocument(char * title, char * sectorname, char * levelname, char * content, int size);

/*
 * Inserts the key generated for a user within a document.
 * Expects a valid user, a valid title and a generated key.
 * Returns 1 for OK, 0 for error.
 */
int addUserDocumentKey(char * user, char * title, char * key);

/*
 * Retrieves the key given for a user and a document.
 * Retrieves NULL if no key exists for that user and title.
 */
char * getUserDocumentKey(char * user, char * title);

int getSize(char * title);

#endif
